#include<iostream>
using namespace std;
#include<vector>
#include<unordered_map>
int main() {
	vector<int> test;
	int n, m,hmax=0;
	cin >> n >> m;
	for (int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		test.push_back(a);
	}
	if (m>n) {
		cout << -1;
		return 0;
	}
	unordered_map<int, int> ma;
	for (auto& e : test)
		hmax = max(++ma[e], hmax);
	int left = 1,right = hmax;
	while (left < right) {
		int mid = left + (right - left) / 2,now = 0;
		for(auto& e:ma)
			now += e.second / mid + (e.second / mid == 0 ? 0 : 1);
		if (now <= m)
			right = mid;
		else
			left = mid+1;
	}
	cout << left;
	return 0;
}